﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SearchMembers
{
    /// <summary>
    /// 搜索包含该数据的单注
    /// </summary>
    /// <param name="searchSingle"></param>
    /// <param name="searchData"></param>
    /// <returns></returns>
    public static List<List<int>> filterSystem(List<int> searchSingle, List<List<int>> searchData)
    {
        List<List<int>> resultData = new List<List<int>>();
        foreach (var VARIABLE in searchData)
        {
            for (int i = 0; i < VARIABLE.Count; i++)
            {
                if (searchSingle.Contains(VARIABLE[i]))
                {
                    resultData.Add(VARIABLE);
                }
            }
        }

        return resultData;
    }

    public static List<List<int>> filterSingleSystem(List<int> searchSingle, List<List<int>> searchData)
    {
        List<List<int>> resultData = new List<List<int>>();
        foreach (var VARIABLE in searchData)
        {
            bool startSingle = true;
            for (int i = 0; i < searchSingle.Count; i++)
            {
                if (!VARIABLE.Contains(searchSingle[i]))
                {
                    startSingle = false;
                    break;
                }
            }

            if (startSingle)
            {
                resultData.Add(VARIABLE);
            }
        }

        return resultData;
    }
}